package com.team.controller;

import com.team.entity.News;
import com.team.service.ApprovalNewsService;
import com.team.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author keluoyisi
 * @program: seven
 * @description: 新闻审批
 * @date 2022-10-18 19:10:28
 */
@Controller
@ResponseBody
@RequestMapping("/ApprovalNewsController")
public class ApprovalNewsController {
    @Autowired
    private ApprovalNewsService approvalNewsService;

    /**
     * @param id:
     * @return Result
     * @description 审核通过修改status
     */
    @RequestMapping("/agree")
    public Result agree(@RequestParam("id") int id){
        System.out.println(id);
        return approvalNewsService.agree(id);
    }

    /**
     * @param news:
     * @return Result
     * @description 审核拒绝修改理由
     */
    @RequestMapping("/refuse")
    public Result refuse(@RequestBody News news){
        System.out.println(news);
        return approvalNewsService.refuse(news);
    }
}
